﻿@model Pre.CRM.Models.CustomersKeyModel
@{
    ViewBag.Title = "CreateKey";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<label class="lb_namecompany">@Model.Id</label>
<a name="" type="button" value="" class="bt_black" width="26"  height="26" href='javascript:history.back();'></a>
    
<div class="border_top" style="margin:15px 0px;clear:both"></div>
<form method="post" id='key'>
    <label class="list_domain" style="margin:15px 0px">Danh sách domain: @string.Join(", ", Model.Domains)</label>
    <div class="border_top" style="margin:15px 0px"></div>
    <label class="float_left" style="margin-top:3px;">Key</label><textarea name="keys" class="input_key" style="height:75px">@Model.Keys</textarea>
    <div style="margin:15px 0px">
        <label class="float_left" style="margin-top:3px;">Số năm đăng ký</label>
        <input name="year" type="text" class="counted_year" value="@Model.Years"/> 
        <input type="hidden" id="action" name="action" value="CREATEKEY"/>
        <input name="" type="submit" value="TẠO KEY" class="bt_cre_key"/>
        @{ var display = string.IsNullOrEmpty(Model.Keys) ? "none" : ""; }
        <center style='display:@display'>
            <input name="input" type="button" onclick="SetAction('UPDATEKEY')" value="UPDATE" class="bt_cre_key margin_top_10px" style="width: 50%"/>
        </center>
    </div>

    <table class="border_top" width="100%" border="0" cellspacing="5" cellpadding="0" style="display:block; clear:both; margin-top:10px;display:@display">
        <tr>
            <td colspan="2"><strong>Gửi mail</strong></td>
        </tr>
        <tr>
            <td>Người nhận:</td>
            <td>
                <input type="radio" name="type" onclick="SetEmail('@Model.EmailAgent')"> Đại lý 
                <input type="radio" name="type" onclick="SetEmail('@Model.EmailCustomer')"> Khách hàng
                <input type="text" id='email' name="email" width="100%"/>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <input name="" type="button" onclick="SetAction('SENDMAIL')" value="SEND MAIL" class="bt_cre_key margin_top_10px" style="width: 50%"/>
            </td>
        </tr>
    </table>
    

</form>
<div class="space"></div>

<script language="javascript">
    function SetAction(value) {
        $('#action').val(value);
        $("#key").submit();
    }

    function SetEmail(value) {
        $('#email').val(value);
    }
</script>